from selenium.webdriver.common.by import By
from Base.Base import Base
import time
class Page(Base):
    # 验证是否成功进入百度
    yz_baidu_loc = (By.XPATH,'/html/body/div[1]/div[2]/div[5]/div[1]/div/form/span[2]/input')
    # 搜索框
    ssk_loc = (By.XPATH,'/html/body/div[1]/div[2]/div[5]/div[1]/div/form/span[1]/input')
    # 点击搜索按钮
    search_btn_loc = (By.XPATH,'/html/body/div[1]/div[2]/div[5]/div[1]/div/form/span[2]/input')
    # 验证的字段
    yz_ceshi_loc = (By.XPATH,'/html/body/div[3]/div[3]/div[1]/div[1]/table/tbody/tr/td/div[2]/div[1]/div/div/div/div[2]/div')
    # 验证的字段1
    yz_ceshi_loc1 = (
    By.XPATH, '/html/body/div[3]/div[3]/div[1]/div[3]/div[1]/div/div/div[1]/div/div/div/div[1]/h3/div/a/font[1]')
    # 验证的字段2
    yz_ceshi_loc2 = (
        By.XPATH, '/html/body/div[3]/div[3]/div[1]/div[3]/div[1]/div/div/div[1]/div/div/div/div[1]/h3/div/a/font[2]')
    # 验证进入百度
    def yz(self):

        return self.text(self.yz_baidu_loc)
    # 搜索我喜欢测试软件
    def search(self):
        self.send_keys(self.ssk_loc,'我喜欢软件测试')
        self.click(self.search_btn_loc)
        return self.text(self.yz_ceshi_loc)

    def get1(self):
        return self.text(self.yz_ceshi_loc1)
    def get2(self):
        self.put_window(2)
        return self.text(self.yz_ceshi_loc2)

